POV-Ray : Newsgroups : povray.binaries.images : using an image_map for media density/color : Re: using an image_map for media density/color Server Time
7 Aug 2024 15:18:46 EDT (-0400)
  Re: using an image_map for media density/color  
From: Kenneth
Date: 11 Apr 2006 03:25:01
Message: <web.443b58abdc50c7b3acc8f35f0@news.povray.org>
"Bob H" <omniverse@charter%net> wrote:
> I've been sitting here looking this over a while now, trying to figure what
> it does, and finally rendered something to check it out here.
>
> ...I also multiplied a color_map gradient
> z to get the fading out effect, as was suggested.
>

Congrats on accomplishing that so quickly; you beat me to it!  Not being
very wise in the way of math functions, I had to slog through a fair amount
of trial-and-error, discarding one attempt after another, before coming up
with a fade-out technique that worked well and looked good. Since the
medias are so dense, I needed a way to fade them out exponentially. Here's
my final result:

Create another pigment function:
#declare my_function_3 =
function{
 pigment{
  gradient z
  color_map{
   [0.0 rgb 1]
   [1.0 rgb 0]
          }
     }
     }

Then use this in each of the four medias the same way, multiplying the
original function in each media by this one.  Like this...

for the absorbing media...

density{
 function{
  my_image_function_1(x,y,z).gray
  * my_function_3(x,y,pow(z,.07)).gray
                     }
           }

and for each emitting media...

density{
 function{
  my_image_function_2(x,y,z).red // and green, and blue
  * my_function_3(x,y,pow(z,.07)).gray
                      }
            }


Play around with pow(z,.07) to see the varying fade-out effect.

BTW, I got rid of the "extra" dino image on the rear of the box by using

interior_texture{pigment{color rgbt 1}}

Not ideal, but it does the job. Interior textures can behave strangely,
depending on where the camera AND the lights are positioned. If the camera
is moved around behind the box, then suddenly the box's REAR dino image is
visible and the front one isn't. And it creates a bit of havoc with light
sources, too. With the camera in the front (the -z direction) and a light
positioned behind the box, the "invisible" rear-face image casts no shadow.
 But if the light is also moved in front of that rear face, suddenly it DOES
cast a shadow...even though the rear image itself is not visible from the
front. The interior_texture doesn't actually ELIMINATE that rear-face image
(which is still on the "outside" surface of the box); it just "hides" it
from the camera and lights--depending on where THEY are.

Ken


Post a reply to this message


Attachments:
Download 'dino_fadeout.jpg' (51 KB)

Preview of image 'dino_fadeout.jpg'
dino_fadeout.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.